package com.aspose.cells;

import java.util.ArrayList;

class zti {
   private zol a = null;
   private Chart b = null;
   private boolean c = false;
   private znx d = null;

   zti(znx var1) {
      this.d = var1;
      if (this.d.h != null) {
         this.c = true;
         this.b = var1.h;
      } else {
         this.a = var1.g;
      }

   }

   void a(zcfx var1) throws Exception {
      this.c(var1);
      this.b(var1);
      var1.b();
      var1.d();
      var1.e();
   }

   private void b(zcfx var1) throws Exception {
      if (!this.c && this.a.a.getType() == 2) {
         this.c(new zny(this.d, this.a.a.getCharts().get(0).getChartObject(), false), var1);
      } else {
         if (this.d.i == null || this.d.i.length == 0) {
            return;
         }

         zny[] var2 = this.d.i;
         int var3 = var2.length;

         for(int var4 = 0; var4 < var3; ++var4) {
            zny var5 = var2[var4];
            Shape var6 = var5.a;
            if (var6 != null) {
               if (zase.a(var6) || var6.getMsoDrawingType() != 0 && var6.getAutoShapeType() == 0) {
                  this.a(var5, var1);
               } else {
                  switch(var6.getMsoDrawingType()) {
                  case 5:
                     this.c(var5, var1);
                     break;
                  case 8:
                     if (var6.g != null && var6.g.g != null) {
                        this.a(var6, var1);
                        break;
                     }

                     this.b(var5, var1);
                     break;
                  case 29:
                  case 30:
                     if (zase.aH(var6.getAutoShapeType())) {
                        this.b(var6, var1);
                     } else {
                        switch(var6.getAutoShapeType()) {
                        case 202:
                           this.a(var5, var1);
                           break;
                        default:
                           this.a(var6, var1);
                        }
                     }
                     break;
                  default:
                     this.a(var5, var1);
                  }
               }
            }
         }
      }

   }

   private void a(Shape var1, zcfx var2) throws Exception {
      if (var1.g != null && var1.g.g != null) {
         var2.d(var1.g.g);
      }

   }

   private void a(zny var1, zcfx var2) throws Exception {
      ztn var3 = new ztn(var1);
      var3.a(var2);
   }

   private void b(Shape var1, zcfx var2) throws Exception {
      zny var3 = new zny(this.d, var1, false);
      ztn var4 = new ztn(var3);
      var4.b(var2);
   }

   private void b(zny var1, zcfx var2) throws Exception {
      if (this.c || this.a.a.getType() == 1) {
         ztn var3 = new ztn(var1);
         var3.a(var2);
      }
   }

   private void c(zny var1, zcfx var2) throws Exception {
      znw var3 = this.a(var1.a);
      if (var3 != null) {
         ztn var4 = new ztn(var1);
         var4.a(var2);
      }
   }

   private znw a(Shape var1) {
      ChartShape var2 = (ChartShape)var1;
      ArrayList var3 = this.d.f;
      int var4 = var3.size();
      if (!this.c && this.a.a.getType() == 2) {
         var4 = Math.min(1, var4);
      }

      for(int var5 = 0; var5 < var4; ++var5) {
         znw var6 = (znw)var3.get(var5);
         if (var6.a != null && var6.a.getChartObject() == var2) {
            return var6;
         }
      }

      return null;
   }

   private void c(zcfx var1) throws Exception {
      if (this.c) {
         var1.b(false);
         var1.b("c:userShapes");
         var1.a("xmlns", "c", (String)null, "http://schemas.openxmlformats.org/drawingml/2006/chart");
      } else {
         var1.b(true);
         var1.b("xdr:wsDr");
         var1.a("xmlns", "xdr", (String)null, "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing");
      }

      var1.a("xmlns", "a", (String)null, "http://schemas.openxmlformats.org/drawingml/2006/main");
      var1.a("xmlns", "r", (String)null, "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
      var1.a("xmlns", "a14", (String)null, "http://schemas.microsoft.com/office/drawing/2010/main");
   }
}
